package News.servlet;

import News.service.Server;
import News.service.UserServer;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class LoginServlet extends Servlet{
    protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
        req.setCharacterEncoding("UTF-8");
        res.setCharacterEncoding("UTF-8");
        String username=req.getParameter("username");
        String password=req.getParameter("password");
        System.out.println("用户名："+username+" \n密码："+password);
        UserServer us=new UserServer();
        int i=us.selectJSONCount(username,password);

        res.setContentType("text/html;charset=UTF-8");
        PrintWriter pw=res.getWriter();
        pw.print(i);
        pw.flush();
        pw.close();
    }
}
